package com.bookyourtrek.action;

import java.math.BigInteger;
import java.util.Map;

import com.bookyourtrek.model.TrekModel;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class ActivateTrekAction extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@SuppressWarnings("rawtypes")
	public String activatetrek() {
		//write code to update the trek status from saved to pending
		Map sess=ActionContext.getContext().getSession();
		
		//validation
		
		if(sess.get("trekid") == null) {
			return "home";
		}
		
		TrekModel tm = new TrekModel();
		BigInteger trekid = (BigInteger) sess.get("trekid");
		tm.activatetrek(trekid);
        sess.remove("trekid");
		return SUCCESS;
	}
}
